package org.example.flink.source;

import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.connector.file.src.FileSource;
import org.apache.flink.connector.file.src.reader.TextLineInputFormat;
import org.apache.flink.core.fs.Path;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;
import java.util.List;


/**
 * @Author: tang
 * @Description:
 * @Date 2025/2/16 01:14
 */
public class FlinkSourceFile {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment();

        FileSource<String> source =
                FileSource.forRecordStreamFormat(
                        new TextLineInputFormat(),
                        new Path("/Users/tanglonglong" +
                                "/idea_project/cloud-test/web-springboot/flink/src/main/resources/words.txt")
                ).build();

        environment
                .fromSource(source, WatermarkStrategy.noWatermarks(), "file-source")
                .print()
        ;


        environment.execute();
    }

}
